package com.pig4cloud.pigx.system.feign;

import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.security.annotation.Inner;
import com.pig4cloud.pigx.system.api.feign.SystemProductFeign;
import com.pig4cloud.pigx.system.entity.SystemProduct;
import com.pig4cloud.pigx.system.service.SystemProductService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统模块-产品feign接口实现类
 *
 * @since 2022/11/26 14:44
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/feign/system/product")
@Api(value = "system-product", tags = "")
public class SystemProductFeignImpl implements SystemProductFeign {

    private final SystemProductService systemProductService;

    /**
     * 根据id查询产品信息
     *
     * @param productId 产品id
     * @param from      标记系统内部请求
     * @return {@link R< Long>}
     * @since 2022/11/26 14:41
     */
    @Inner
    @Override
    @GetMapping(GET_BY_ID)
    public R<SystemProduct> getById(Long productId, String from) {
        SystemProduct product = systemProductService.getById(productId);
        return R.ok(product);
    }
}
